package com.basic;


import com.frame.struts.BaseBean;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.frame.struts.ActionContext;
import com.utils.*;
import java.util.Date;


/**
 * <p>Title: </p>
 * <p>Description: </p>
 * <p>Copyright: Copyright (c) 2006</p>
 * <p>Company: </p>
 * @author not attributable
 * @version 1.0
 */

public class SalaryForm extends BaseBean {
	
	private static final long serialVersionUID = 1L;

	private String qyid ;

	private String bkys ;
	private String bkysbl ;
	private String dz ;
	private String dzbl ;
	private String zz ;
	private String zzbl ;
	private String gzyx ;
	private String gzyxbl ;
	private String gz ;
	private String gzbl ;

	private String year1 ;
	private String year2 ;
	private String year3 ;



	private String gsrrs1 ;
	private String gsrhj1 ;
	private String zsrrs1 ;
	private String zsrhj1 ;
	private String dsrrs1 ;
	private String dsrhj1 ;

	private String gsrrs2 ;
	private String gsrhj2 ;
	private String zsrrs2 ;
	private String zsrhj2 ;
	private String dsrrs2 ;
	private String dsrhj2 ;

	private String gsrrs3 ;
	private String gsrhj3 ;
	private String zsrrs3 ;
	private String zsrhj3 ;
	private String dsrrs3 ;
	private String dsrhj3 ;

	private String cw1 ;
	private String cwhj1 ;
	private String cw2 ;
	private String cwhj2 ;
	private String cw3 ;
	private String cwhj3 ;


	private String qt1 ;
	private String qthj1 ;
	private String qt2 ;
	private String qthj2 ;
	private String qt3 ;
	private String qthj3 ;


    private String optrid;
	private String xh;
	private String optdate;
	private String recstate;
	private String remark;
	//49
	
	
	private String gjzc ;
	private String gzcbl ;
	private String zjzc ;
	private String zzcbl ;
	private String cjzc ;
	private String dzcbl ;
	
	
	private String ygdwwdx;
	private String rypb;
	
	//private float total_1,total_2,t_1,t_2,t_3,to_1,to_2,to_3;
	
	/****************************ADD LATER********************************************/
	private String glrs="";
	private String glrshj="";
	private String guanlizzl1="";
	private String guanlizzl2="";
	private String jsrs="";
	private String jsrshj="";
	private String jishuzzl1="";
	private String jishuzzl2="";
	private String xsrs="";
	private String xsrshj="";
	private String xiaoshouzzl1="";
	private String xiaoshouzzl2="";
	private String cwrs="";
	private String cwrshj="";
	private String caiwuzzl1="";
	private String caiwuzzl2="";
	private String qtrs="";
	private String qtrshj="";
	private String qitazzl1="";
	private String qitazzl2="";
	private String zhj="";
	private String total_1="";
	private String total_2="";
	private String t_1="";
	private String t_2="";
	private String t_3="";
	private String to_1="";
	private String to_2="";
	private String to_3="";
	
	private String reportyear="";
	private String xyryzs="";
	
	private PresalaryForm pre1=new PresalaryForm();
	private PresalaryForm pre2=new PresalaryForm();
	private PresalaryForm pre3=new PresalaryForm();
	/*****************************ADD LATER*******************************************/
    public SalaryForm() {
    }
	public String addSalary(){
		HttpServletRequest request = ActionContext.getActionContext().
			getRequest();
		HttpServletResponse response = ActionContext.getActionContext().
			getResponse();
		BasicFactory factory = new BasicFactory();
		String qyid = (String) request.getSession().getAttribute("session_qyid");
		this.setQyid(qyid);
		this.setOptdate(new Date().toString());
		this.setOptrid(CommUtil.getUserId(request));
		try{
			if(factory.addSalary(this)){
				response.sendRedirect(request.getContextPath()+"/gudong/modifySalary.jsp");
			}else
			{
				response.sendRedirect(request.getContextPath()+"/failed.jsp");
			}
		}
		catch (Exception e) {

		}

		return null;
	}
	public String getQyid() {
		return qyid;
	}
	public float getTotal(String[]bran)
	{
		float tot=0f;
		for(String s:bran)
		{
			if(s!=null&&!s.trim().equals(""))
			{
				try{
				tot+=Float.parseFloat(s);
				}catch(NumberFormatException ex)
				{
					
				}
			}
		}
		return tot;
	}
	/*public int getTotal_1() {
		return new Float(getTotal(new String[]{this.bkys,this.dz,zz,gzyx,gz})).intValue();
	}
	public int getTotal_2() {
		return new Float(getTotal(new String[]{gjzc,zjzc,cjzc})).intValue();
	}
	
	
	public int getT_1() {
		return new Float(getTotal(new String[]{gsrrs1,zsrrs1,dsrrs1,cw1,qt1})).intValue();
	}
	public int getT_2() {
		return new Float(getTotal(new String[]{gsrrs2,zsrrs2,dsrrs2,cw2,qt2})).intValue();
	}
	public int getT_3() {
		return new Float(getTotal(new String[]{gsrrs3,zsrrs3,dsrrs3,cw3,qt3})).intValue();
	}
	public float getTo_1() {
		return getTotal(new String[]{gsrhj1,zsrhj1,dsrhj1,cwhj1,qthj1});
	}
	public float getTo_2() {
		return getTotal(new String[]{gsrhj2,zsrhj2,dsrhj2,cwhj2,qthj2});
	}
	public float getTo_3() {
		return getTotal(new String[]{gsrhj3,zsrhj3,dsrhj3,cwhj3,qthj3});
	}*/
	
	
	
	public PresalaryForm getPre1() {
		return pre1;
	}
	public void setPre1(PresalaryForm pre1) {
		this.pre1 = pre1;
	}
	public PresalaryForm getPre2() {
		return pre2;
	}
	public void setPre2(PresalaryForm pre2) {
		this.pre2 = pre2;
	}
	public PresalaryForm getPre3() {
		return pre3;
	}
	public void setPre3(PresalaryForm pre3) {
		this.pre3 = pre3;
	}
	public int getGuanliCount()
	{
		return new Float(getTotal(new String[]{gsrrs1,gsrrs2,gsrrs3})).intValue();
	}
	public int getJishuCount()
	{
		return new Float(getTotal(new String[]{zsrrs1,zsrrs2,zsrrs3})).intValue();
	}
	public int getXiaosouCount()
	{
		return new Float(getTotal(new String[]{dsrrs1,dsrrs2,dsrrs3})).intValue();
	}
	public int getCaiwuCount()
	{
		return new Float(getTotal(new String[]{cw1,cw2,cw3})).intValue();
	}
	public int getQitaCount()
	{
		return new Float(getTotal(new String[]{qt1,qt2,qt3})).intValue();
	}
	public int getTotalCount()
	{
		return new Float(getTotal(new String[]{gsrrs1,gsrrs2,gsrrs3,zsrrs1,zsrrs2,zsrrs3,dsrrs1,dsrrs2,dsrrs3,cw1,cw2,cw3,qt1,qt2,qt3})).intValue();
	}

	public String getGuanliCountBl()
	{
		if(getTotalCount()==0)
		{
			return 0+"%";
		}else
		{
			return (Math.round((float)getGuanliCount()/getTotalCount())*100)+"%";
		}
	}
	public String getJishuCountBl()
	{
		if(getTotalCount()==0)
		{
			return 0+"%";
		}else
		{
			return (Math.round((float)getJishuCount()/getTotalCount())*100)+"%";
		}
	}public String getXiaosouCountBl()
	{
		if(getTotalCount()==0)
		{
			return 0+"%";
		}else
		{
			return (Math.round((float)getXiaosouCount()/getTotalCount())*100)+"%";
		}
	}public String getCaiwuCountBl()
	{
		if(getTotalCount()==0)
		{
			return 0+"%";
		}else
		{
			return (Math.round((float)getCaiwuCount()/getTotalCount())*100)+"%";
		}
	}public String getQitaCountBl()
	{
		if(getTotalCount()==0)
		{
			return 0+"%";
		}else
		{
			return (Math.round(((float)getQitaCount())/getTotalCount())*100)+"%";
		}
	}
	public String getSalaryGrowthRate(String[]type)
	{
		float totalSalary1=0;
		float totalPerson1=0;
		try{
				if(type!=null)
				{
					if(type[0]!=null)totalPerson1=Float.parseFloat(type[0]);
					if(type[1]!=null)totalSalary1=Float.parseFloat(type[1]);
				}
			}catch(NumberFormatException ex)
			{
				ex.printStackTrace();
			}
		if(totalPerson1==0)
		{
			return 0+"%";
		}
		float firstYear=totalSalary1/totalPerson1;
		
		
		float totalSalary2=0;
		float totalPerson2=0;
		try{
				if(type!=null)
				{
					if(type[2]!=null)totalPerson2=Float.parseFloat(type[2]);
					if(type[3]!=null)totalSalary2=Float.parseFloat(type[3]);
				}
			}catch(NumberFormatException ex)
			{
				ex.printStackTrace();
			}
		if(totalPerson2==0)
		{
			return 0+"%";
		}
		float secondYear=totalSalary2/totalPerson2;
		
		if(firstYear==0)
		{
			return 0+"%";
		}else
		{
			return (Math.round((secondYear-firstYear)/firstYear)*100)+"%";
		}
	}
	
	public String getGuanliRate1st()
	{
		return getSalaryGrowthRate(new String[]{this.gsrrs1,this.gsrhj1,this.gsrrs2,this.gsrhj2});
	}
	public String getGuanliRate2nd()
	{
		return getSalaryGrowthRate(new String[]{this.gsrrs2,this.gsrhj2,this.gsrrs3,this.gsrhj3});
	}
	
	public String getReportyear() {
		return reportyear;
	}
	public void setReportyear(String reportyear) {
		this.reportyear = reportyear;
	}
	public String getXyryzs() {
		return xyryzs;
	}
	public void setXyryzs(String xyryzs) {
		this.xyryzs = xyryzs;
	}
	public String getJishuRate1st()
	{
		return getSalaryGrowthRate(new String[]{this.zsrrs1,this.zsrhj1,this.zsrrs2,this.zsrhj2});
	}
	public String getJishuRate2nd()
	{
		return getSalaryGrowthRate(new String[]{this.zsrrs2,this.zsrhj2,this.zsrrs3,this.zsrhj3});
	}
	
	public String getXiaosouRate1st()
	{
		return getSalaryGrowthRate(new String[]{this.dsrrs1,this.dsrhj1,this.dsrrs2,this.dsrhj2});
	}
	public String getXiaosouRate2nd()
	{
		return getSalaryGrowthRate(new String[]{this.dsrrs2,this.dsrhj2,this.dsrrs3,this.dsrhj3});
	}
	
	public String getCaiwuRate1st()
	{
		return getSalaryGrowthRate(new String[]{this.cw1,this.cwhj1,this.cw2,this.cwhj2});
	}
	public String getCaiwuRate2nd()
	{
		return getSalaryGrowthRate(new String[]{this.cw2,this.cwhj2,this.cw3,this.cwhj3});
	}
	
	public String getQitaRate1st()
	{
		return getSalaryGrowthRate(new String[]{this.qt1,this.qthj1,this.qt2,this.qthj2});
	}
	public String getQitaRate2nd()
	{
		return getSalaryGrowthRate(new String[]{this.qt2,this.qthj2,this.qt3,this.qthj3});
	}
	
	
	
	
	
	
	
	
	public void setQyid(String qyid) {
		this.qyid = qyid;
	}
	public String getBkys() {
		return bkys;
	}
	public String zsrhj3() {
		return bkys;
	}
	public void setBkys(String bkys) {
		this.bkys = bkys;
	}
	public String getBkysbl() {
		return bkysbl;
	}
	public void setBkysbl(String bkysbl) {
		this.bkysbl = bkysbl;
	}
	public String getDz() {
		return dz;
	}
	public void setDz(String dz) {
		this.dz = dz;
	}
	public String getDzbl() {
		return dzbl;
	}
	public void setDzbl(String dzbl) {
		this.dzbl = dzbl;
	}
	public String getGjzc() {
		return gjzc;
	}
	public void setGjzc(String gjzc) {
		this.gjzc = gjzc;
	}
	public String getGzcbl() {
		return gzcbl;
	}
	public void setGzcbl(String gzcbl) {
		this.gzcbl = gzcbl;
	}
	public String getZjzc() {
		return zjzc;
	}
	public void setZjzc(String zjzc) {
		this.zjzc = zjzc;
	}
	public String getZzcbl() {
		return zzcbl;
	}
	public void setZzcbl(String zzcbl) {
		this.zzcbl = zzcbl;
	}
	public String getCjzc() {
		return cjzc;
	}
	public void setCjzc(String cjzc) {
		this.cjzc = cjzc;
	}
	public String getDzcbl() {
		return dzcbl;
	}
	public void setDzcbl(String dzcbl) {
		this.dzcbl = dzcbl;
	}
	
	public String getZz() {
		return zz;
	}
	public void setZz(String zz) {
		this.zz = zz;
	}
	public String getZzbl() {
		return zzbl;
	}
	public void setZzbl(String zzbl) {
		this.zzbl = zzbl;
	}
	public String getGzyx() {
		return gzyx;
	}
	public void setGzyx(String gzyx) {
		this.gzyx = gzyx;
	}
	public String getGzyxbl() {
		return gzyxbl;
	}
	public void setGzyxbl(String gzyxbl) {
		this.gzyxbl = gzyxbl;
	}
	public String getGz() {
		return gz;
	}
	public void setGz(String gz) {
		this.gz = gz;
	}
	public String getGzbl() {
		return gzbl;
	}
	public void setGzbl(String gzbl) {
		this.gzbl = gzbl;
	}
	public String getYear1() {
		return year1;
	}
	public void setYear1(String year1) {
		this.year1 = year1;
	}
	public String getYear2() {
		return year2;
	}
	public void setYear2(String year2) {
		this.year2 = year2;
	}
	public String getYear3() {
		return year3;
	}
	public void setYear3(String year3) {
		this.year3 = year3;
	}
	public String getGsrrs1() {
		return gsrrs1;
	}
	public void setGsrrs1(String gsrrs1) {
		this.gsrrs1 = gsrrs1;
	}
	public String getGsrhj1() {
		return gsrhj1;
	}
	public void setGsrhj1(String gsrhj1) {
		this.gsrhj1 = gsrhj1;
	}
	public String getZsrrs1() {
		return zsrrs1;
	}
	public void setZsrrs1(String zsrrs1) {
		this.zsrrs1 = zsrrs1;
	}
	public String getZsrhj1() {
		return zsrhj1;
	}
	public void setZsrhj1(String zsrhj1) {
		this.zsrhj1 = zsrhj1;
	}
	public String getDsrrs1() {
		return dsrrs1;
	}
	public void setDsrrs1(String dsrrs1) {
		this.dsrrs1 = dsrrs1;
	}
	public String getDsrhj1() {
		return dsrhj1;
	}
	public void setDsrhj1(String dsrhj1) {
		this.dsrhj1 = dsrhj1;
	}
	public String getGsrrs2() {
		return gsrrs2;
	}
	public void setGsrrs2(String gsrrs2) {
		this.gsrrs2 = gsrrs2;
	}
	public String getGsrhj2() {
		return gsrhj2;
	}
	public void setGsrhj2(String gsrhj2) {
		this.gsrhj2 = gsrhj2;
	}
	public String getZsrrs2() {
		return zsrrs2;
	}
	public void setZsrrs2(String zsrrs2) {
		this.zsrrs2 = zsrrs2;
	}
	public String getZsrhj2() {
		return zsrhj2;
	}
	public void setZsrhj2(String zsrhj2) {
		this.zsrhj2 = zsrhj2;
	}
	public String getDsrrs2() {
		return dsrrs2;
	}
	public void setDsrrs2(String dsrrs2) {
		this.dsrrs2 = dsrrs2;
	}
	public String getDsrhj2() {
		return dsrhj2;
	}
	public void setDsrhj2(String dsrhj2) {
		this.dsrhj2 = dsrhj2;
	}
	public String getGsrrs3() {
		return gsrrs3;
	}
	public void setGsrrs3(String gsrrs3) {
		this.gsrrs3 = gsrrs3;
	}
	public String getGsrhj3() {
		return gsrhj3;
	}
	public void setGsrhj3(String gsrhj3) {
		this.gsrhj3 = gsrhj3;
	}
	public String getZsrrs3() {
		return zsrrs3;
	}
	public void setZsrrs3(String zsrrs3) {
		this.zsrrs3 = zsrrs3;
	}
	public String getZsrhj3() {
		return zsrhj3;
	}
	public void setZsrhj3(String zsrhj3) {
		this.zsrhj3 = zsrhj3;
	}
	public String getDsrrs3() {
		return dsrrs3;
	}
	public void setDsrrs3(String dsrrs3) {
		this.dsrrs3 = dsrrs3;
	}
	public String getDsrhj3() {
		return dsrhj3;
	}
	public void setDsrhj3(String dsrhj3) {
		this.dsrhj3 = dsrhj3;
	}
	public String getCw1() {
		return cw1;
	}
	public void setCw1(String cw1) {
		this.cw1 = cw1;
	}
	public String getCwhj1() {
		return cwhj1;
	}
	public void setCwhj1(String cwhj1) {
		this.cwhj1 = cwhj1;
	}
	public String getCw2() {
		return cw2;
	}
	public void setCw2(String cw2) {
		this.cw2 = cw2;
	}
	public String getCwhj2() {
		return cwhj2;
	}
	public void setCwhj2(String cwhj2) {
		this.cwhj2 = cwhj2;
	}
	public String getCw3() {
		return cw3;
	}
	public void setCw3(String cw3) {
		this.cw3 = cw3;
	}
	public String getCwhj3() {
		return cwhj3;
	}
	public void setCwhj3(String cwhj3) {
		this.cwhj3 = cwhj3;
	}
	public String getQt1() {
		return qt1;
	}
	public void setQt1(String qt1) {
		this.qt1 = qt1;
	}
	public String getQthj1() {
		return qthj1;
	}
	public void setQthj1(String qthj1) {
		this.qthj1 = qthj1;
	}
	public String getQt2() {
		return qt2;
	}
	public void setQt2(String qt2) {
		this.qt2 = qt2;
	}
	public String getQthj2() {
		return qthj2;
	}
	public void setQthj2(String qthj2) {
		this.qthj2 = qthj2;
	}
	public String getQt3() {
		return qt3;
	}
	public void setQt3(String qt3) {
		this.qt3 = qt3;
	}
	public String getQthj3() {
		return qthj3;
	}
	public void setQthj3(String qthj3) {
		this.qthj3 = qthj3;
	}
	public String getOptrid() {
		return optrid;
	}
	public void setOptrid(String optrid) {
		this.optrid = optrid;
	}
	public String getXh() {
		return xh;
	}
	public void setXh(String xh) {
		this.xh = xh;
	}
	public String getOptdate() {
		return optdate;
	}
	public void setOptdate(String optdate) {
		this.optdate = optdate;
	}
	public String getRecstate() {
		return recstate;
	}
	public void setRecstate(String recstate) {
		this.recstate = recstate;
	}
	public String getRemark() {
		return remark;
	}
	public void setRemark(String remark) {
		this.remark = remark;
	}
	public String getYgdwwdx() {
		return ygdwwdx;
	}
	public void setYgdwwdx(String ygdwwdx) {
		this.ygdwwdx = ygdwwdx;
	}
	public String getRypb() {
		return rypb;
	}
	public void setRypb(String rypb) {
		this.rypb = rypb;
	}
	public String getGlrs() {
		return glrs;
	}
	public void setGlrs(String glrs) {
		this.glrs = glrs;
	}
	public String getGlrshj() {
		return glrshj;
	}
	public void setGlrshj(String glrshj) {
		this.glrshj = glrshj;
	}
	public String getGuanlizzl1() {
		return guanlizzl1;
	}
	public void setGuanlizzl1(String guanlizzl1) {
		this.guanlizzl1 = guanlizzl1;
	}
	public String getGuanlizzl2() {
		return guanlizzl2;
	}
	public void setGuanlizzl2(String guanlizzl2) {
		this.guanlizzl2 = guanlizzl2;
	}
	public String getJsrs() {
		return jsrs;
	}
	public void setJsrs(String jsrs) {
		this.jsrs = jsrs;
	}
	public String getJsrshj() {
		return jsrshj;
	}
	public void setJsrshj(String jsrshj) {
		this.jsrshj = jsrshj;
	}
	public String getJishuzzl1() {
		return jishuzzl1;
	}
	public void setJishuzzl1(String jishuzzl1) {
		this.jishuzzl1 = jishuzzl1;
	}
	public String getJishuzzl2() {
		return jishuzzl2;
	}
	public void setJishuzzl2(String jishuzzl2) {
		this.jishuzzl2 = jishuzzl2;
	}
	public String getXsrs() {
		return xsrs;
	}
	public void setXsrs(String xsrs) {
		this.xsrs = xsrs;
	}
	public String getXsrshj() {
		return xsrshj;
	}
	public void setXsrshj(String xsrshj) {
		this.xsrshj = xsrshj;
	}
	public String getXiaoshouzzl1() {
		return xiaoshouzzl1;
	}
	public void setXiaoshouzzl1(String xiaoshouzzl1) {
		this.xiaoshouzzl1 = xiaoshouzzl1;
	}
	public String getXiaoshouzzl2() {
		return xiaoshouzzl2;
	}
	public void setXiaoshouzzl2(String xiaoshouzzl2) {
		this.xiaoshouzzl2 = xiaoshouzzl2;
	}
	public String getCwrs() {
		return cwrs;
	}
	public void setCwrs(String cwrs) {
		this.cwrs = cwrs;
	}
	public String getCwrshj() {
		return cwrshj;
	}
	public void setCwrshj(String cwrshj) {
		this.cwrshj = cwrshj;
	}
	public String getCaiwuzzl1() {
		return caiwuzzl1;
	}
	public void setCaiwuzzl1(String caiwuzzl1) {
		this.caiwuzzl1 = caiwuzzl1;
	}
	public String getCaiwuzzl2() {
		return caiwuzzl2;
	}
	public void setCaiwuzzl2(String caiwuzzl2) {
		this.caiwuzzl2 = caiwuzzl2;
	}
	public String getQtrs() {
		return qtrs;
	}
	public void setQtrs(String qtrs) {
		this.qtrs = qtrs;
	}
	public String getQtrshj() {
		return qtrshj;
	}
	public void setQtrshj(String qtrshj) {
		this.qtrshj = qtrshj;
	}
	public String getQitazzl1() {
		return qitazzl1;
	}
	public void setQitazzl1(String qitazzl1) {
		this.qitazzl1 = qitazzl1;
	}
	public String getQitazzl2() {
		return qitazzl2;
	}
	public void setQitazzl2(String qitazzl2) {
		this.qitazzl2 = qitazzl2;
	}
	public String getZhj() {
		return zhj;
	}
	public void setZhj(String zhj) {
		this.zhj = zhj;
	}
	public void setTotal_1(String total_1) {
		this.total_1 = total_1;
	}
	public void setTotal_2(String total_2) {
		this.total_2 = total_2;
	}
	public void setT_1(String t_1) {
		this.t_1 = t_1;
	}
	public void setT_2(String t_2) {
		this.t_2 = t_2;
	}
	public void setT_3(String t_3) {
		this.t_3 = t_3;
	}
	public void setTo_1(String to_1) {
		this.to_1 = to_1;
	}
	public void setTo_2(String to_2) {
		this.to_2 = to_2;
	}
	public void setTo_3(String to_3) {
		this.to_3 = to_3;
	}
	public String getTotal_1() {
		return total_1;
	}
	public String getTotal_2() {
		return total_2;
	}
	public String getT_1() {
		return t_1;
	}
	public String getT_2() {
		return t_2;
	}
	public String getT_3() {
		return t_3;
	}
	public String getTo_1() {
		return to_1;
	}
	public String getTo_2() {
		return to_2;
	}
	public String getTo_3() {
		return to_3;
	}
	
	
}